﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListSupportingMaterial.ascx.cs"
            Inherits="Pantry.Web.Users.Controls.ListSupportingMaterial" %>
<%@ Register Namespace="SiteUtils" Assembly="CollectionPager" TagPrefix="cc1" %>
<asp:UpdatePanel runat="server" ID="PanelListSupportingMaterial">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="CollectionPager" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="CheckboxIsInActive" EventName="CheckedChanged" />
        <asp:AsyncPostBackTrigger ControlID="LinkSortByUrl" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkSortByDescription" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkSortByType" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkSortByAddedBy" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="LinkSortByAddedDate" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="RepeaterListSupportingMaterial" EventName="ItemCommand" />
    </Triggers>
    <ContentTemplate>
        <div id="create_contact" class="g_12">
            <div class="widget_header">
                <h4 class="widget_header_title wwIcon i_16_forms">
                    Current List of Supporting Materials
                </h4>
                <div class="ActionListSupportingMaterial">
                    <asp:Button runat="server" CssClass="Duongnt8Button" Text="Create" OnClick="CreateSupportingMaterialClick" />&nbsp;
                    <asp:CheckBox runat="server" ID="CheckboxIsInActive" AutoPostBack="true" Checked="true"
                        Text="Include In-active" />
                </div>
            </div>
            <div class="widget_contents noPadding">
                <table class="tables">
                    <thead>
                        <tr>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByUrl" runat="server" Text="URL" OnClick="SortUrlClick" />
                            </th>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByDescription" runat="server" Text="Description" OnClick="SortDesClick" />
                            </th>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByType" runat="server" Text="Type" OnClick="SortTypeClick" />
                            </th>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByAddedBy" runat="server" Text="Added By" OnClick="SortAddedByClick" />
                            </th>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByAddedDate" runat="server" Text="Added Date" OnClick="SortAddedDateClick" />
                            </th>
                            <th class="sorting">
                                <asp:LinkButton ID="LinkSortByIsActive" runat="server" Text="Is Active" OnClick="SortIsActiveClick" />
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="RepeaterListSupportingMaterial" runat="server" OnItemCommand="MarkActivated">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                       <asp:HiddenField ID="HiddenFieldMaterialId" runat="server" Value='<%# String.Format("{0}${1}",Eval("OrgID"),Eval("Id")) %>' />
                                        <asp:LinkButton ID="LinkButton1" runat="server" Visible='<%#Eval("IsActive").Equals("Yes")? true : false %>'><%#Eval("Url")%></asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" Visible='<%#Eval("IsActive").Equals("No")? true : false %>' OnClientClick="return confirm('Do you want to make this Supporting Material active?');" CommandName="update"><%#Eval("Url")%></asp:LinkButton>
                                    </td>
                                    <td>
                                        <%# Eval("Description")%>
                                    </td>
                                    <td>
                                        <%# Eval("Type")%>
                                    </td>
                                    <td>
                                        <%# Eval("AddedBy")%>
                                    </td>
                                    <td>
                                        <%# Eval("AddedDate")%>
                                    </td>
                                    <td>
                                        <%# Eval("IsActive")%>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
                <div class="dtBottom">
                    <div class="dtPagination">
                        <cc1:CollectionPager ID="CollectionPager" runat="server" HideOnSinglePage="false"
                            BackText="Back" FirstText="First" ShowLabel="False" ShowFirstLast="False" NextText="Next"
                            ResultsLocation="None" PageNumbersSeparator=" " PagingMode="PostBack">
                        </cc1:CollectionPager>
                    </div>
                </div>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel>
